

/**
 * api接口统一管理
 */


import { get, post, postFormData } from './http'
export const login = p => post('user/login', p);//保存 post方法
export const logins = p => post('user/logins', p);//保存 post方法

// 登录验证码

export const user_checkCode = p => get("/user/checkCode", p) //获取登陆验证码



export const getAllType = (p) => get('farm/getAllType?state=', p);//查看田间管理所有方式
export const addType = (p) => post('farm/saveType', p);//添加田间管理方式
export const delType = (p) => post('farm/delType', p);//删除田间管理方式

/*
    中控
*/
//政府客户   企业客户
export const goverment_findByList = p => post('company/findByList', p); //列表
export const goverment_delete = p => get('company/delete/', p);//删除
export const goverment_save = p => postFormData('company/save', p);//新增
export const goverment_check = p => get('company/findById/', p);//查看
export const companyAppmenu = (id) => get('/company/load/appmenus/' + id)
export const companySetAppmenu = (params) => post('/company/set/appmenus', params)

// 广告管理
export const advertList = p => post("/advert/findList", p) //列表
export const advertSave = p => postFormData("/advert/save", p) //新增
export const advertDelete = p => get("/advert/deletes/", p) // 删除
export const advertfindById = p => get("/advert/findById/", p) //根据id 获取详情

// 发送消息
export const messageList = p => post("/message/findByListSend", p) //列表
export const messageSave = p => post("/message/save", p) //新增

export const messagefindById = p => get("/message/findByPid/", p) //根据id 获取详情
export const messageExport = p => get("/message/sendAllStatus/", p)


// 模型库
export const model_findByList = p => post('/model/classify/findByList', p);
export const model_findByOne = p => post('/model/classify/findByOne', p)
export const model_findByTwo = p => get('/model/classify/findByTwo/', p)
export const model_save = p => postFormData('/model/classify/save', p)
export const model_findByParentId = p => get('/model/classify/findByParentId/', p)
export const model_cropsave = p => postFormData('/model/crop/save', p)
export const model_findByOneId = p => get('/model/crop/findByOneId/', p)
export const crop_findById = p => get('/model/crop/findById/', p)
export const model_findById = p => get("/model/classify/findById/", p)
export const momdel_delete = p => get("/model/classify/delete/", p)
export const model_crop_delete = p => get("/model/crop/delete/", p)

export const model_crop_update = p => post("/model/crop/update", p)
export const model_crop_srarch = p => post("/model/crop/search", p)


// 产品管理

export const control_list = p => get('/control/app/list/', p)
export const app_used = (id, used) => get('/control/app/used/' + id + "/" + used)//更改app启用禁用状态
export const appMenus = (id) => get('/control/app/menus/' + id)
export const appAddResource = (params) => post('/control/app/add/resource', params)
export const appDeleResource = (id) => get('/control/app/dele/resource/' + id)
export const control_save = p => postFormData('/control/app/createcustomapp', p)//新增
export const control_lists = p => post("/control/app/list/customapp", p)
export const control_resourcesave = p => post("/resource/save", p)//权限新增
export const control_get = p => get("/resource/findByAppId/", p)//获取权限
export const control_createsave = p => post("/control/app/create/customappversion", p)
export const findCustomAppVersionId = p => get("/control/app/findCustomAppVersionId/", p)
export const customappversion = p => get("/control/app/list/customappversion/", p)

// 供应商管理
export const supplier_findByList = p => post('/supplier/findByList', p) //列表
export const supplier_delete = p => get('/supplier/delete/', p) //删除
export const supplier_save = p => post('/supplier/save', p) //新增
export const supplier_update = p => post('/supplier/update', p) //修改
export const supplier_findByAll = p => get('/supplier/findByAll', p) //下拉
export const supplier_findById = p => get('/supplier/findById/', p) //下拉
export const supplier_findByListLog = p => post('/supplier/findByListLog', p) //下拉


// 客户管理
export const client_findByList = p => post('/client/findByList', p)//列表
export const client_delete = p => get('/client/delete/', p)//删除
export const client_save = p => post('/client/save', p)//新增
export const client_update = p => post('/client/update', p)//修改
export const client_findById = p => get('/client/findById/', p)//详情页
export const client_findByAll = p => get("/client/findByAll/", p) // 客户下拉
export const client_findOrderAll = p => post("/clientorder/client/detail", p) // 客户订单列表

// 检测依据
export const check_findByList = p => post("check/findByList", p)//列表
export const check_delete = p => get("check/delete/", p)//删除
export const check_update = p => post("check/update", p)//修改
export const check_findById = p => get("check/findById/", p)//详情
export const check_save = p => post("check/save", p)//新增
export const check_findByAll = p => get("check/findByAll", p)//下拉所有检测依据

// 设备管理
export const facility_findByList = p => post('/equipment/findByList', p)//列表
export const facility_delete = p => get('/equipment/delete/', p)//删除
export const facility_save = p => post('/equipment/save', p)//新增
export const facility_update = p => post('/equipment/update', p)//修改
export const facility_findById = p => get('/equipment/findById/', p)//查询
export const facility_findByAll = p => get('/equipment/findByAll', p)//下拉查询
export const equipment_findByType = p => post("equipment/findByType", p)//设备下拉
export const facility_del = p => get("/soil/equiment/dele/", p) 
export const getParamList = p => get("/dataAnalyse/getParamList?", p) // 获取设备参数
export const getByEquId = p => post("/iot/getByEquId?" + p) // 获取阈值列表
export const saveThreshold = p => post("/iot/saveThreshold", p) // 新增阈值

// 分级标准
export const grade_findByList = p => post("grade/findByList", p)//列表
export const grade_delete = p => get("grade/delete/", p)//删除
export const grade_update = p => post("grade/update", p)//修改
export const grade_findById = p => get("grade/findById/", p)//详情
export const grade_save = p => post("grade/save", p)//新增


//单位管理
export const unit_findByList = p => get('unit/findByAll', p); //列表
export const unit_delete = p => get('unit/delete/', p);//删除
export const unit_save = p => post('unit/saves', p);//新增

// 工艺工序
export const technology_findByList = p => post("technology/findByList", p)//列表
export const technology_delete = p => get("/technology/delete/", p)//删除
export const technology_update = p => post("technology/update", p)//修改
export const technology_findById = p => get("technology/findById/", p)//详情
export const technology_save = p => postFormData("technology/save", p)//新增
export const technology_findByAll = p => get("technology/findByAll", p)//新增

//检测管理
export const processDetail_findByList = p => post("processDetail/findByList", p)//加工检测列表
export const storageManage_findByList = p => post("storage/manage/findByList", p)//采购检测列表
export const processDetail_findById = p => get("processDetail/findById/", p)//加工检测
export const detection_save = p => post("detection/save", p)//新增检查
export const detection_findById = p => get("detection/findByRelevanceId/", p)//新增检查

// 员工管理
export const staff = p => post('department/save', p);
export const staff_findById = p => get('department/findByCompanyId/', p);
export const staff_getId = p => get('department/findByParentId/', p);
export const staff_save = p => post('department/save', p);
export const staff_update = p => post('department/update', p);
export const staff_getfindById = p => get('department/findById/', p);
export const staff_delete = p => get('department/delete/', p);







//人员管理
export const user_findByAll = p => get("user/findByAll", p)//下拉所有人员
export const staffuser_save = p => postFormData('user/save', p);
export const staffuser_findByList = p => post('user/findByList', p);
export const staffuser_delete = p => get('user/delete/', p);
export const staffuser_update = p => postFormData('user/update', p);
export const staffuser_findById = p => get('user/findById/', p);
export const staffuser_findByAll = p => get('department/findByAll', p);
export const staffuser_daoru = p => postFormData('user/excel', p);
export const staffuser_checkPwd = p => post("user/checkPassword", p);
export const user_locked = p => post("/user/locked", p)

// 企业信息
export const company_findById = p => get('company/findById/', p); //获取企业信息
export const company_update = p => postFormData('company/update', p)

// 基源管理
export const basesource_findByAll = p => get("/model/crop/findByCompany", p)
export const basesource_delete = p => get("/model/crop/company/delete/", p)
export const basesource_save = p => post("/model/crop/company/save", p)

// 仓储养护
export const curing_psave = p => post("/storage/curing/plantSave", p)
export const curing_save = p => post("/storage/curing/save", p)
export const curing_findByList = p => post("/storage/curing/findByList", p)
export const curing_delete = p => get("/storage/curing/delete/", p)
export const curing_findById = p => get("/storage/curing/findById/", p)
export const curing_update = p => post("/storage/curing/update", p)
export const curing_findByAll = p => get("/storage/curing/findByAll", p)




// 产销对接
export const productDock_save = p => post("/productDock/save", p)
export const productDock_update = p => post("/productDock/update", p)
export const productDock_findByList = p => post("/productDock/findByList", p)
export const productDock_delete = p => get("/productDock/delete/", p)
export const productDock_findById = p => get("/productDock/findById/", p)
// 科技服务
export const scienceInfo_tree = p => get("/scienceInfo/tree", p)//获取分类列表
export const scienceInfo_treeList = p => post("/scienceInfo/findByList", p)//列表
export const scienceInfo_findById = p => get("/scienceInfo/findById/", p)//根据id查详情
export const scienceInfo_save = p => post("/scienceInfo/save", p)//新增
export const scienceInfo_deleteById = p => get("/scienceInfo/deleteById/", p)//删除



// 产品信息
export const products_save = p => post("/product/save", p)
export const products_findByList = p => post("/product/findByList", p)
export const products_delete = p => get("/product/delete/", p)
export const products_findByAll = p => get("/product/findByAll", p)
export const products_findById = p => get("/product/findById/", p)

// 物联网
export const saveName = p => post("/iot/saveName", p)


// export const products_save = p =>







// 基地管理
export const base_findByList = p => post('basesoil/search', p);  //加载地块信息
export const base_findByPositionList = p => post('/warehouse/part/detail', p);  //加载仓库地块信息
export const base_findById = p => post('soil/findById/', p);
export const base_delete = p => get('basesoil/dele/', p);  //删除地块、建筑
export const base_deleteCangWei = p => get('warehouse/partdele/', p);  //删除仓位
export const base_details = p => get('basesoil/load/', p);  //详情
export const base_findByAll = p => get('soil/findAllBase', p)
// export const plot_findByAll = p => post('soil/findSoilByType',p)
export const plot_findByAll = p => get('basesoil/loadroot', p)  //加载所有基地

// 投入品管理
export const inputs_save = p => post('inputs/save', p);//新增
export const inputs_findByList = p => post('inputs/findByList', p);//列表
export const inputs_findById = p => get('inputs/findById/', p);//查看详情

// 种植管理
export const plant_save = p => post('plant/save', p);//新增
export const plant_findByList = p => post('plant/findByList', p);//列表
export const plant_findById = p => get('plant/findById/', p);//查看详情

export const plant_view = p => get("plant/view/", p)
// export const plant_push = p => post("/plant/push",p)
// export const farm_findByUserId = p =>get("/farm/findByUserId/",p)
// 采收管理
export const revovery_part = p => get("/model/crop/findByModelId/", p)//获取部位
export const reap_save = p => postFormData("/reap/save", p)//新增采收
export const reap_findByList = p => post("/reap/findByList", p)//采收列表
export const reap_findById = p => get("/reap/findById/", p) //

// 仓储管理

export const storage_save = p => post("/storage/manage/save", p)// 新增入库
export const storage_findByList = p => post("/storage/manage/findByList", p)// 列表
export const storage_adjustment = p => post("/storage/manage/adjustment", p)//调整库存
export const storage_findById = p => get("/storage/manage/findById/", p)//明细
export const storage_curing_save = p => postFormData("/storage/manage/curing/save", p)//养护
export const storage_outByStorage = p => get("/storage/manage/outByStorageId/", p) //待入库 出库信息
export const storage_out = p => post("/storage/manage/out", p) // 出库物流

export const storage_manage_sourceinfo = p => get("traceinfo/sourceinfo?code=", p)//根据溯源码查询信息

// 田间管理
export const farm_save = p => postFormData("farm/save", p)
export const farm_push = p => post("/farm/push", p)
export const farm_findByUserId = p => get("/farm/findByUserId/", p)

export const farm_finish = p => post("farm/finish", p)
export const farm_jobdetail = p => get("farm/jobdetail/", p)

export const farm_findById = p => get("/farm/findById/", p)

// 加工管理

export const reapdetail_findByList = p => post("reapDetail/findByList", p)  //加工 原料下拉
export const reapDetail_findAllBreed = p => get("reapDetail/findAllBreed", p)   //选择加工原料时 品名的下拉

export const process_save = p => postFormData("process/save", p)
export const process_findByList = p => post("processDetail/findByList", p)
export const process_findById = p => get("/process/findById/", p)//根据id 查询加工详情

export const process_bind = p => get("processDetail/bindProductMsg/", p)

// 分包管理

export const sub_findByList = p => post("sub/findByList", p) //分包列表
export const sub_save = p => post("plantsub/save", p) // 点击分包

export const sub_findByRelevanceId = p => get("sub/findByRelevanceId/", p) //分包查看列表


// 订单管理

// export const order_save = p => post("order/save",p)//新增订单
export const order_save = p => post("clientorder/add", p)//新增订单
export const order_findByList = p => post("clientorder/search", p)// 订单列表
export const order_delete = p => get("clientorder/dele/", p)//删除
export const order_update = p => post("clientorder/pay", p)//修改
export const order_findById = p => get("clientorder/load/", p)// 根据id 查询详情


// 赋码管理

export const sub_findPrintMsg = p => get("sub/findPrintMsg/", p)
export const sub_offLinePrint = p => post("sub/offLinePrint", p) // 离线下载
// export const sub_findByList = p => post("sub/findByList",p)//赋码管理 列表sub/findByList

export const get_code = p => post("sub/getCode", p)



// 中控 基源管理
export const modecategory_update = p => postFormData("/modecategory/update", p)  //分类添加和修改

export const modecategory_tree = p => get("/modecategory/tree", p) //获取tree

export const modecategory_root = p => get("modecategory/root/", p) //获取一级分类
export const modecategory_child = p => get("modecategory/child/", p) //获取二级分类
export const modecategory_load = p => get("modecategory/load/", p) //获取分类信息
export const modecategory_dele = p => get("/modecategory/dele/", p)//删除
export const model_crop_add = p => postFormData("/model/crop/add", p) //添加作物

export const model_crop_category = p => get("/model/crop/category/", p)//获取所有作物
export const model_crop_load = p => get("/model/crop/load/", p)//获取 作物详情


// 种养殖 基源管理
export const model_category_tree = p => get("/model/category/tree", p)//获取基源树
export const model_crop_load_category = p => get("/model/crop/load/category/", p) //获取所有基源
export const model_crop_bindone = p => post("/model/crop/bindone", p) //绑定解绑 作物
export const model_crop_loadbind = p => get("/model/crop/loadbind", p)
export const model_crop_search = p => post("/model/crop/search", p)



// 权限管理   组织权限

export const department_bindresource = p => post("/department/bindresource", p)  //组织权限绑定
export const department_loadresource = p => get("/department/loadresource/", p)


//员工管理 导入 导出
export const template_importUser = p => postFormData("/template/importUser", p)

export const temmplate_toUser = p => get("/template/toUser", p)

//客户管理 导入 导出
export const template_importClient = p => postFormData("/template/importClient", p)

//供应商管理 导入 导出
export const template_importSupplier = p => postFormData("/template/importSupplier", p)


// 追溯查询

// export const traceinfo_fromlaststep = p => get("traceinfo/fromlaststep/",p)//初加工的详细  信息


export const traceinfo_fromlaststep = p => get("traceinfo/fromlaststep/", p)


/* 召回 */

export const recall_page = p => post("/recall/page", p)//列表

export const recall_add = p => post("/plant/recall/add", p)//新增

export const recall_load = p => get("/recall/load/", p)//加载

export const recall_chain = p => post("/plant/recall/chain", p)

export const recall_edit = p => post("/recall/modify", p)


// 仓储管理

export const warehouse_list = p => get("/warehouse/list", p)   // 仓库下拉

export const warehouse_listpart = p => get("/warehouse/listpart/", p) //仓位下拉

export const plant_storage = p => post("/plant/storage", p) //种植入库

export const storage_manage_out = p => post("/storage/manage/out", p) //出库

export const storage_manage_down_codes = p => get("/storage/manage/down/codes?", p) //采购入库后根据storageManageId下载码

export const warehouse_tree = p => get("warehouse/tree", p)  //列表仓库 下拉

export const clientorder_storage_orders = p => post("clientorder/storage/orders", p)  //待出库列表

export const storage_manage_out_checkcode = p => get("/storage/manage/out/checkcode/", p) //出库时检测验证码是否正确






// 企业设置

export const conpanyshow_load = p => get("/companyshow/load/", p)//加载企业秀

export const conpanyshow_update = p => post("/companyshow/update", p) //修改企业秀



// 地块

export const basesoil_download = p => get("/basesoil/download/", p) //下载地块码


// 空码管理
export const sub_page_spacebox = p => post("/sub/page/spacebox", p)// 申请空码记录

export const sub_apply_spacebox = p => post("/sub/apply/spacebox", p)//申请空吗

export const sub_spacebox_download = p => get("/sub/spacebox/download/", p) //下载空吗

export const sub_spacebox_active = p => post("/sub/spacebox/active", p) //空码激活

export const sub_spacebox_upload = p => post("/sub/spacebox/upload", p)//上传文件激活



// 中控产品管理   获取权限 接口
export const modecategory_loadroot = p => get("/modecategory/loadroot/cusomappversion/", p)

// 中控 政府客户 配置 保存
export const set_gov_setcustomapp = p => postFormData("/company/set/gov/setcustomapp", p)

// 获取 产品  名称
export const app_listall_customapp = p => get("/control/app/listall/customapp", p)

// 根据产品名称 获取版本
export const app_list_customappversion = p => get("/control/app/list/customappversion/", p)

// 获取政府已绑定应用
export const company_get_customapp = p => get("/company/get/customapp/", p)

// 获取  企业 的隶属
export const company_findByType = p => get("company/findByType/", p)


export const company_get_govconfig = p => get("company/get/govconfig/", p)


// 种植 平台 首页

export const plant_box_codeCount = p => get("/box/codeCount?", p)

export const plant_user_userNum = p => get("/user/userNum?", p)

export const plant_farm_fieldCZCount = p => get("/farm/fieldCZCount?", p)

export const process_daoru = p => postFormData("/template/importCraft", p)


// 根据系统查询公司

export const getCompanyByCustomAppId = p => get("/usercenter/company/getCompanyByCustomAppId?", p)




//数据中心接口

export const getplantcomp = p => get("data/getPlantComp?", p)
